package com.aidex.biz.service.impl;

import com.aidex.biz.domain.Customer;
import com.aidex.biz.domain.RxkOrder;
import com.aidex.biz.mapper.RxkOrderMapper;
import com.aidex.biz.service.CheYouRongOrderService;
import com.aidex.biz.service.RxkOrderService;
import com.aidex.common.annotation.DataScope;
import com.aidex.common.core.service.BaseServiceImpl;
import com.aidex.common.utils.NumberUtils;
import com.aidex.common.utils.StringUtils;
import com.aidex.common.utils.http.HttpUtils;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * 车优融客户订单Service业务层处理
 * @author sean
 * @email 2074844820@qq.com
 * @date 2024-05-30
 */
@Service
@Transactional(readOnly = true)
public class CheYouRongOrderServiceImpl  implements CheYouRongOrderService
{
    private static final Logger log = LoggerFactory.getLogger(CheYouRongOrderServiceImpl.class);
    private final String Host ="http://crm.cheyourong.com/api/webApi/pushCustomer/";

    @Override
    public JSONObject checkOrder(Customer customer) {
        String url=Host+"/customerCheck";
        JSONObject params=new JSONObject();
        if (StringUtils.isNotEmpty(customer.getPhone())){
            params.put("phone",customer.getPhone());
        }
        if (StringUtils.isNotEmpty(customer.getPhoneMD5())){
            params.put("phoneMD5",customer.getPhoneMD5());
        }
        String json= HttpUtils.doPost(url, params);
        return  JSONObject.parseObject(json);
    }

    @Override
    public JSONObject insertOrder(Customer customer) {
            String url=Host+"/insertCustomer";
            String json= HttpUtils.doPost(url, JSONObject.toJSONString(customer));
            return  JSONObject.parseObject(json);
    }
}
